<%@page import="com.ym.b2b.cache.configcache.WebAppConfig"%>
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="b" uri="/b2b-tags"%>
<link href="<c:url value="/resources/styles/ypxq.css" />" rel="stylesheet" type="text/css" />
<link href="<c:url value="/views/jsp/product/view_more_picture/view_product_picture.css" />" rel="stylesheet" type="text/css" />
<link href="<c:url value="/views/jsp/product/shoppingcart/css/select.css" />" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/javascript" src="<c:url value="/views/jsp/product/shoppingcart/js/jQuery-shopping.js" />"></script>
<script>
setFocus(4);
</script>
<div class="mianbox">
 <div class="ypxq_left">
  <div class="left_top">
   <ul>
   <b:position typeId="${result.data.emBProduct.productTypeCode }" positionType="productCategory" /> 
   <li>${result.data.emBProduct.chsName }</li>
   </ul>
  </div>
  <div class="ypxq_box">
   <div class="ypxq_ing">
   
   <div class="preview">
		<div id="vertical" class="bigImg">
			<c:if test="${not empty result.data.pictureList}">
			    <c:forEach var="picList" items="${result.data.pictureList }">
			    	<c:if test="${picList.isDefault == 1}">
			   			<img src="<%=WebAppConfig.getPicPath() %>${picList.bigPicture }" width="400" height="400" alt="" id="midimg" />
					</c:if>
				</c:forEach>
			</c:if>
			 <c:if test="${empty result.data.pictureList}">
			 	<img src="<%=WebAppConfig.getPicPath() %>/images/noPic.jpg" width="400" height="400" alt="" id="midimg" />
			 </c:if>
			<div style="display:none;" id="winSelector"></div>
		</div>
		<!--bigImg end-->	
		<div class="smallImg">
			<div class="scrollbutton smallImgUp disabled"></div>
			<div id="imageMenu">
				<ul>
				<!-- 有图 -->
				<c:if test="${not empty result.data.pictureList}">
					  <c:forEach var="picList" items="${result.data.pictureList }">
				    	<c:if test="${picList.isDefault ==1}">
				    		<li id="onlickImg"><img src="<%=WebAppConfig.getPicPath() %>${picList.smallPicture }" width="68" height="68"  /></li>
						</c:if>
					  </c:forEach>
					  <c:forEach var="picList" items="${result.data.pictureList }">
						<c:if test="${picList.isDefault !=1}">
							<li><img src="<%=WebAppConfig.getPicPath() %>${picList.smallPicture }" width="68" height="68"  /></li>
						</c:if>
					  </c:forEach>
				 </c:if>
				 <!-- 无图 -->
				 <c:if test="${empty result.data.pictureList}">
				    <li id="onlickImg"><img src="<%=WebAppConfig.getPicPath() %>/images/noPic.jpg" width="68" height="68" hasPic="false" /></li>
				 </c:if>
				 
				
				</ul>
			</div>
			<div class="scrollbutton smallImgDown"></div>
		</div>
		<!--smallImg end-->	
		<div id="bigView" style="display:none;">
			<img width="800" height="800" alt="" src="" />
		</div>
	</div>
   </div>
   
    <div class="ypxq_detail">
	    <h1 style="height: auto;">
	   		 ${result.data.emBProduct.productName }
		     <span style="display: block;font-size: 14px;font-weight: 600;color: #e72418;margin-top: 3px;"> 
		    	${result.data.emBProduct.purpose } 
		     </span>
	    </h1>
    <ul>
		<li>
			<dl>
				<dt>产品编号：</dt>
				<dd>${result.data.emBProduct.productCode}</dd>
			</dl>
			<dl class="yy">
				<dt>拼&nbsp;音&nbsp;&nbsp;码：</dt>
				<dd>${result.data.emBProduct.spell }</dd>
			</dl>
		</li>
		<li>
			<dl>
				<dt>生产厂家：</dt>
				<dd>${result.data.emBProduct.producingName }</dd>
			</dl>
			<dl class="yy">
				<dt>产&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;地：</dt>
				<dd>${result.data.emBProduct.producingArea }</dd>
			</dl>
		</li>
		<li>
			<dl>
				<dt>批准文号：</dt>
				<dd>${result.data.emBProduct.authorizeNumber }</dd>
			</dl>
			<dl class="yy">
				<dt>所属范围：</dt>
				<dd>${result.data.emBProduct.businesscope }</dd>
			</dl>
		</li>
		<li>
			<dl>
				<dt>产品规格：</dt>
				<dd>${result.data.emBProduct.productSpec }</dd>
			</dl>
			<dl class="yy">
				<dt>品牌：</dt>
				<dd>${result.data.emBProduct.brand }</dd>
			</dl>
		</li>
		<li>
			<dl>
				<dt>浏览次数：</dt>
				<dd>${result.data.emBProduct.browseQuantity }</dd>
			</dl>
			<dl class="yy">
				<dt>销售次数：</dt>
				<dd>${result.data.emBProduct.totalTrading }</dd>
			</dl>
		</li>
		<!--
		     <li>
		      <dl>
		        <dt>整件价：</dt>
		        <dd>￥${result.data.emBProduct.fullSalePrice }</dd>
		      </dl>
		      <dl class="yy">
		        <dt>中包价：</dt>
		        <dd>￥${result.data.emBProduct.middlePackPrice }</dd>
		      </dl>
		     </li>
		-->
		<li>
			<dl>
				<dt>OTC分类：</dt>
				<dd>${result.data.emBProduct.otcType }</dd>
			</dl>
			<dl class="yy">
				<dt>剂&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;型：</dt>
				<dd>${result.data.emBProduct.medicamentName }</dd>
			</dl>
		</li>
		<li>
			<dl>
				<dt>整件装:</dt>
				<dd>${result.data.emBProduct.packingAmount}</dd>
			</dl>
			<dl class="yy">
				<dt>包装单位:</dt>
				<dd>${result.data.emBProduct.packingUnit}</dd>
			</dl>
		</li>
		<li>
			<dl>
				<dt>
				库存:
				<c:if test="${not empty sessionScope.WEB_USER_TOKEN}">
                	<dd>${result.data.emBProduct.stockNum}</dd>
				</c:if>
				<c:if test="${empty sessionScope.WEB_USER_TOKEN}">
                	<dd>登录查看</dd>
				</c:if>
				</dt>
			</dl>
     		<dl class="yy">
         		<a href="javascript:void(0);" class="linkFavorite" title="收藏该商品" id="addUserFavalit" >收藏该商品</a>           
      		</dl>
     	</li>
    </ul> 
    
    <!-- 促销信息 -->
    <c:if test="${not empty  result.data.promoDetail}">
	   <div class="promotion-info"  style="display: block;"> 
			<div class="title">
				<strong>促销政策:</strong> &nbsp;
				${result.data.promoDetail.promoDesc}
			</div>
			<div class="promotion-time">
				<span class="fl">
					距离活动结束还有：
				</span>
				<div class="countdown fl" id="endPromo">
					<em class="day">..</em>
					天
					<em class="hour">..</em>
					时
					<em class="minute">..</em>
					分
					<em class="second">..</em>
					秒
				</div>
			</div>
		</div>
		<script language="javascript" type="text/javascript"> 
			var endTime = '${result.data.promoDetail.endTime}';
			if(endTime!=null && endTime!=""){
				var interval = 1000; 
				function ShowCountDown(time,divname){ 
					var spTime = time.split("-");
					var now = new Date(); 
					var endDate = new Date(spTime[0], spTime[1]-1, spTime[2]); 
					var leftTime=endDate.getTime()-now.getTime(); 
					var leftsecond = parseInt(leftTime/1000); 
					var day1=Math.floor(leftsecond/(60*60*24)); 
					var hour=Math.floor((leftsecond-day1*24*60*60)/3600); 
					var minute=Math.floor((leftsecond-day1*24*60*60-hour*3600)/60); 
					var second=Math.floor(leftsecond-day1*24*60*60-hour*3600-minute*60); 
					$("#endPromo .day").text(day1);
					$("#endPromo .hour").text(hour);
					$("#endPromo .minute").text(minute);
					$("#endPromo .second").text(second);
				} 
				window.setInterval(function(){ShowCountDown('${result.data.promoDetail.endTime}','divdown1');}, interval); 
			}
			</script> 					
	</c:if>						
							
   </div>
   
   
   
   
  </div>
  <div class="ypxq_table_xx">
   <div class="table_xx_title" id="table_xx_title">
    <ul>
      <li><a href="" class="xy" onclick=" return false;">药品说明书</a></li>
      <!-- <li><a href="" onclick=" return false;">配送方式</a></li> -->
    </ul>
     <span style="float: right;"> 
	<a href="javascript:downPaper('<%=WebAppConfig.getPicPath() %>/views/jsp/product/product_qualification_down_s.jsp?productCode=${result.data.emBProduct.productCode }')"
					class="download" target="_blank">资质/批件信息</a> 
	<a href="###" onclick="layer.feedBack()" >
			欢迎纠错
	</a>
   </span>
   </div>
  
   <div id="choose_ul">
   <!--药品说明书-->
   <div class="table_xx_cen" style="display:block;">
   	  <c:if test="${result.data.emBProductIntroduction.useType==1 }">
   	  	  <p class="sms"><b>【成份】</b>${result.data.emBProductIntroduction.iCompose }</p>
          <p class="sms"><b>【性状】</b>${result.data.emBProductIntroduction.iCharacter }</i></p>
          <p class="sms"><b>【功能主治】</b>${result.data.emBProductIntroduction.iFunction }</p>
          <p class="sms"><b>【用法用量】</b>${result.data.emBProductIntroduction.iUsage }</p>
          <p class="sms"><b>【不良反应】</b>${result.data.emBProductIntroduction.iBadness }</p>
          <p class="sms"><b>【禁忌】</b>${result.data.emBProductIntroduction.iTaboo }</p>
          <p class="sms"><b>【药物相互作用】</b>${result.data.emBProductIntroduction.iReciprocity }</p>
          <p class="sms"><b>【注意事项】</b>${result.data.emBProductIntroduction.iNotice }</p>
	      <p class="sms"><b>【贮藏】</b>${result.data.emBProductIntroduction.iStore }</p>
	      <p class="sms"><b>【包装】</b>${result.data.emBProductIntroduction.iPacking }</p>
	      <p class="sms"><b>【有效期】</b>${result.data.emBProductIntroduction.iValidity }</p>
	      <p class="sms"><b>【执行标准】</b>${result.data.emBProductIntroduction.iStandard }</p>
   	  </c:if>
   	  <c:if test="${result.data.emBProductIntroduction.useType==2 }">
   	  	  ${result.data.emBProductIntroduction.descript}
   	  </c:if>
   </div>
   
   <!--配送方式-->
   <div class="table_xx_cen" style="display:none;">
	        配送方式
   </div>
   <!--付款方式-->
   <div class="table_xx_cen" style="display:none;">
      	付款方式
   </div>
   <!--常见问题-->
   <div class="table_xx_cen" style="display:none;">
    	常见问题
   </div>
   </div>
  </div>
 </div>
 
<%-- 


 <div class="ypxq_right">
  <div  class="right_list">
   <div class="tj_top"><span>看看同类</span> </div>
   <div id="tj_cen1">
    <ul>
    <b:showProduct outResponseAttrName="kindList" limitRow="8" productTypeCode="${result.data.emBProduct.productTypeCode}" />
    	<c:if test="${kindList.code eq '100'}">
    		 ${kindList.result}
    	</c:if>
    	<c:forEach var="p1" items="${kindList.rows }" varStatus="index" end="8">
	    	 <li>
	        	<div class="tj_img">
	        		<a href="<c:url value="/product/showProductDetail.s" />?productCode=${p1.productCode}">
	        			<img src="<%=WebAppConfig.getPicPath() %>${p1.middlePic}" width="200" height="200"/>
	        		</a>
	        	</div>
		        <h3>${p1.chsName }</h3>
		        <p><em>${p1.viewPrice }</em><em class="new">￥${p1.retailPrice }</em><span>成交${p1.totalTrading } 盒</span></p>
	     	 </li>
    	</c:forEach>
    </ul>
     </div>
   <div class="tj_bottom"><span class="pre"><img src="<c:url value="/resources/images/ypxq/up.jpg" />" /></span><span class="next"><img src="<c:url value="/resources/images/ypxq/down.jpg" />" /></span></div>
  </div>
 
 </div> --%>
 </div>
	

<!--内容结束-->
<script src="<c:url value="/views/jsp/product/view_more_picture/product_detail.js" />" type="text/javascript"></script>
<script>
 

function buyNow(productCode){
	location.href="<c:url value="/shoppingCart/addShoppingCart.s" />?productCode="+productCode;
}
function add(){
	if(isNaN($('#amount_11').val())){
		alert("请输入数字");
		$('#amount_11').focus();
		return;
	}
	 var number =Number($('#amount_11').val())+Number(1);
	 $('#amount_11').val(number);
}
function jian(){
	if($('#amount_11').val()>1){
		var number =Number($('#amount_11').val())+Number(-1);
		$('#amount_11').val(number);
	}else{
		return ;
	}
}

$(function(){
	//加入购物车
	$(".Q-buy-btn").shoping();

	layer.use('extend/layer.ext.js');
	//加入收藏
	$("#addUserFavalit").click(function(){
    	layer.prompt({title: '输入收藏备注，并确认',type: 3,val:'${result.data.emBProduct.chsName}'}, function(pass){
	    	var p = {
					"productCode":'${result.data.emBProduct.productCode}',
					"notes":pass,
					"type":"product",
					"url":"/product/showProductDetail.s?productCode=${result.data.emBProduct.productCode}",
					"objectName":'${result.data.emBProduct.chsName}'
			    	};
    	    $.ajax({
				type:"post",
				data:p,
				dataType:"json",
				url:"<c:url value='/trade/addUserFavorites.s' />",
				success:function(data){
					if(data.code=="200"){
						layer.msg("加入收藏成功",1, {type: 1,shade: [0.2, '#ccc']});
					}else{
						layer.msg(data.result,1, {type: 8,shade: [0.2, '#ccc']});
					}
				}
	    	});
    	});

	});
});


//批件及资料下载
function downPaper(url){
	$.layer({
	    type: 2,
	    shade: [0],
	    fix: false,
	    title: '批件及资料下载',
	    maxmin: true,
	    iframe: {src : url},
	    area: ['1000px' , '540px'],
	    close: function(index){
	        //layer.msg('您获得了子窗口标记：' + layer.getChildFrame('#name', index).val(),3,1);
	    }
	});
}
</script>